package com.asen.commons.core.base.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * 基于ID主键的核心基类
 *
 * @author ls
 * @version 1.0
 * @date 2024-04-09
 */
@Data
@NoArgsConstructor
public abstract class Core extends RootModel {

    private static final long serialVersionUID = 5733448030750848513L;

    public Core(Long id) {
        this.id = id;
    }

    @ApiModelProperty(value = "id", position = 999)
    private Long id;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Core core = (Core) o;
        return Objects.equals(id, core.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
